package com.mega.ycy.mixin;

import com.mega.ycy.Yiciyuan_EVENT;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@SuppressWarnings({"UnresolvedMixinReference", "MixinAnnotationTarget"})
@Mixin(InventoryPlayer.class)
public class InventoryMixin {
    @Shadow public EntityPlayer player;

    /**
     * @author dropAllItems
     */
    @Inject(method = "func_70436_m", at = @At("HEAD"), cancellable = true)
    public void drop(CallbackInfo ci) {
        if (Yiciyuan_EVENT.isSafe(player))
            ci.cancel();
    }
}
